import User.*;
import zy.Warehouse;

import java.util.Scanner;

/*
 *@Student 张策
 */
public class Main {
    public static boolean F_id(){//厨师登录的方法
        String ID = "qidian";//厨师ID
        String PASSWORD = "123456";//厨师密码
        int choice=3;//输入机会
        int sleepTime=5000;//睡眠时间
        Scanner scanner=new Scanner(System.in);
        System.out.println("注意你有三次登录账号的机会！");
        String id;
        String passWord;
        while (true) {
            System.out.print("请输入账号：");
            id=scanner.nextLine();
            System.out.print("请输入密码：");
            passWord=scanner.nextLine();
            if(id.equals(ID)&&id.equals(PASSWORD)){
                return true;
            }else {
                choice--;
                System.out.println("账号密码输入错误你还有"+choice+"次机会");
            }
            if(choice<=0){
                System.out.println(choice+"次机会用尽，"+sleepTime/1000+"秒后重新进入系统");
                try {
                    Thread.sleep(sleepTime);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }finally {
                    return false;
                }
            }
        }
    }
    public static User login(){//角色选择
        System.out.println("欢迎来到起点炒个菜，请选择你的身份：");
        System.out.println("1:厨师  2:顾客  3:退出");
        Scanner scanner=new Scanner(System.in);
        int rose=scanner.nextInt();
        if(rose==1){
            boolean bool = F_id();//厨师账号登录
            if(bool){
                System.out.println("登入成功，欢迎大厨！");
                return new Chef();
            }else {
                return null;
            }
        }else if(rose==2){
            return new Customer();
        }else if(rose==3){
            return null;
        }
        return null;
    }
    public static void main(String[] args) {
        Warehouse warehouse = new Warehouse();
        User login = login();
        if (login==null){
            System.exit(0);
        }
        while (true){
            int choice=login.menu();

        }
    }
}